home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / PInterfaces / MC68000Test.p < prev    next >
Encoding:
Text File  |  1994-07-27  |  3.2 KB  |  96 lines  |  [TEXT/MPS ]

  1. {
  2.     MC68000Test.p
  3.     Pascal Interface to routines to test to see if they are running on a MC68000 Processor
  4.  
  5.     Copyright Apple Computer, Inc. 1991, 1994
  6.     All rights reserved
  7.  
  8. }
  9.  
  10. {$IFC UNDEFINED UsingIncludes}
  11. {$SETC UsingIncludes := 0}
  12. {$ENDC}
  13.  
  14. {$IFC NOT UsingIncludes}
  15.     UNIT MC68000Test;
  16.     INTERFACE
  17. {$ENDC}
  18.  
  19. {$IFC UNDEFINED UsingMC68000Test AND UNDEFINED __MC68000TEST__}
  20. {$SETC UsingMC68000Test := 1}
  21. {$SETC __MC68000TEST__ := 1}
  22.  
  23. (*
  24. The following routines are provided to the outside caller to handle checking to see if
  25. we are runing on the “proper” processor:
  26.  
  27. • To just do the check for the MC68000...
  28.  
  29.             FUNCTION onMC68000: Boolean; C;
  30.             
  31. • To do the check for MC68000 for MPW tools and to abort with an error message to stderr
  32.     if we're on a MC68000...
  33.  
  34.             PROCEDURE abortToolOnMC68000(exitCode: Integer); C;
  35.             
  36. • To do the check for MC68000 for MPW tools or applications and to abort with an alert
  37.     dialog if we're on a MC68000...
  38.     
  39.             PROCEDURE abortOnMC68000; C;
  40.  
  41. If the machine is an MC68000, then abortToolOnMC68000() and abortOnMC68000() generate the
  42. following message (appropriately formatted):
  43.  
  44.     “Sorry!  This program assumes an MC68020, MC68030, or MC68040 processor.  It cannot be
  45.      run on your MC68000 machine.”
  46.  
  47. There is a possible error condition where the processor cannot be determined using the
  48. SysEnvirons() system trap (on systems older than 4.1).  In that case the following message
  49. is generated:
  50.  
  51.     “Sorry! I cannot determine what processor you are running on!  Since this program assumes
  52.      you are running on an MC68020, MC68030, or MC68040, I am going to assume you have an
  53.      MC68000 so it cannot be run on your machine.”
  54.  
  55. Roughly, the cose of using abortToolOnMC68000() is about 750 bytes and abortOnMC68000()
  56. is about 1000 bytes.  By contrast, onMC68000, which doesn't really do much of anything
  57. costs about 100 bytes.
  58.  
  59. Note: these routines live in their own private segment, MC68000Test.  The caller might
  60. want to do an UnloadSeg() on return since these routines would normally only be called
  61. once or you may want to resegment these routines to be part of your initialization code.
  62. They were segmented seperately to allow easy unloading or resegmenting.
  63. *)
  64.  
  65. FUNCTION onMC68000: Boolean; C;
  66.     (*
  67.     This routine returns true if we are currently running on an MC68000 and false otherwise.
  68.     It is provided for convenience for those callers who wish to take some more appropriate
  69.     actions based on the processor (other than just aborting with a canned error message).
  70.     *)
  71.  
  72.  
  73. PROCEDURE abortToolOnMC68000(exitCode: Integer); C;
  74.     (*
  75.     This routine aborts a MPW Shell tool if it's running on an MC68000 processor.  It is
  76.     assumed that we are being called by an MPW Shell tool.  It writes a message to stderr and
  77.     aborts the tool if we are on a MC68000.  The tool exit status code is specified by the
  78.     caller (in exitCode).  If 0 is specified, 1 will be used.
  79.     
  80.     If we are NOT on a MC68000, the routine simply returns to allow running of the tool.
  81.     *)
  82.  
  83.  
  84. PROCEDURE abortOnMC68000; C;
  85.     (*
  86.     This routine aborts the calling program if it's running on an MC68000 processor.  The
  87.     caller can be either an MPW Shell tool OR a standard Mac application.  It displays a
  88.     message in an alert dialog and aborts if we are on a MC68000.  
  89.     *)
  90.  
  91. {$ENDC}    { UsingMC68000Test }
  92.  
  93. {$IFC NOT UsingIncludes}
  94.     END.
  95. {$ENDC}
  96.